const mysqlx = require('@mysql/xdevapi')

const sess = mysqlx.getSession({
    host: 'localhost',
    user: 'ruser',
    password: '123'
})


function getMessage() {
    return sess.then(session => {
        const t = session.getSchema('test').getTable('t')
        return t.select(['id', 'message']).execute()
    })
    .then(res => {
        return res.fetchOne()[1]
    })
}

module.exports = getMessage